package com.example.infrastructure.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class EnvironmentService {

    @Autowired
    private Environment env;

    public String getActiveProfile() {
        return env.getActiveProfiles().length > 0 ? env.getActiveProfiles()[0] : "default";
    }

    public boolean isTestEnvironment() {
        return "test".equals(getActiveProfile());
    }

    public boolean isDevelopmentEnvironment() {
        return "dev".equals(getActiveProfile());
    }

    public boolean isProductionEnvironment() {
        return "prod".equals(getActiveProfile());
    }



    // 更多的环境检查方法...
}
